home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form planet
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Orbit"
- ClientHeight = 5310
- ClientLeft = 540
- ClientTop = 1590
- ClientWidth = 8040
- Height = 6000
- Icon = PLANET.FRX:0000
- Left = 480
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 120.819
- ScaleMode = 0 'User
- ScaleWidth = 113.559
- Top = 960
- Width = 8160
- Begin TextBox Text7
- Height = 375
- Left = 6120
- TabIndex = 10
- Top = 4800
- Width = 1815
- End
- Begin TextBox Text5
- Height = 375
- Left = 6240
- TabIndex = 9
- Top = 4320
- Width = 1695
- End
- Begin SSPanel lookhere
- AutoSize = 3 'AutoSize Child To Panel
- BevelInner = 1 'Inset
- BevelWidth = 2
- ForeColor = &H00000000&
- Height = 855
- Left = 120
- TabIndex = 31
- Top = 4320
- Width = 4575
- Begin PictureBox mark
- AutoRedraw = -1 'True
- BackColor = &H00C0C0C0&
- BorderStyle = 0 'None
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00FF0000&
- Height = 645
- Left = 105
- ScaleHeight = 645
- ScaleWidth = 4365
- TabIndex = 32
- Top = 105
- Width = 4365
- End
- End
- Begin TextBox Text6
- Height = 375
- Left = 6480
- TabIndex = 8
- Top = 3840
- Width = 1455
- End
- Begin CheckBox seconds
- BackColor = &H00C0C0C0&
- Caption = "Two Suns"
- Height = 255
- Left = 3000
- TabIndex = 12
- Top = 3840
- Width = 1215
- End
- Begin CheckBox datarec
- BackColor = &H00C0C0C0&
- Caption = "Record Data"
- Enabled = 0 'False
- Height = 255
- Left = 3000
- TabIndex = 13
- Top = 3480
- Width = 1455
- End
- Begin TextBox Text12
- Height = 375
- Left = 5760
- TabIndex = 7
- Top = 3360
- Width = 2175
- End
- Begin Frame Frame1
- BackColor = &H00C0C0C0&
- Caption = "Bodies"
- Height = 855
- Left = 120
- TabIndex = 29
- Top = 3360
- Width = 2535
- Begin PictureBox suns
- AutoSize = -1 'True
- DragIcon = PLANET.FRX:0302
- Height = 510
- Left = 1920
- Picture = PLANET.FRX:0604
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 33
- Top = 240
- Width = 510
- End
- Begin PictureBox Picture3
- AutoSize = -1 'True
- DragIcon = PLANET.FRX:0906
- Height = 510
- Left = 1320
- Picture = PLANET.FRX:0C08
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 30
- Top = 240
- Width = 510
- End
- Begin PictureBox Picture2
- AutoSize = -1 'True
- DragIcon = PLANET.FRX:0F0A
- Height = 510
- Left = 720
- Picture = PLANET.FRX:120C
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 11
- Top = 240
- Width = 510
- End
- Begin PictureBox Picture1
- AutoSize = -1 'True
- DragIcon = PLANET.FRX:150E
- Height = 510
- Left = 120
- Picture = PLANET.FRX:1810
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 1
- Top = 240
- Width = 510
- End
- End
- Begin SSCommand SSCommand2
- AutoSize = 2 'Adjust Button Size To Picture
- Caption = "Clear"
- Font3D = 3 'Inset w/light shading
- ForeColor = &H00000000&
- Height = 255
- Left = 3720
- TabIndex = 16
- Top = 3000
- Width = 1095
- End
- Begin TextBox Text11
- Height = 375
- Left = 5760
- TabIndex = 6
- Top = 2880
- Width = 2175
- End
- Begin TextBox Text16
- Height = 375
- Left = 3720
- TabIndex = 14
- Top = 2520
- Width = 1095
- End
- Begin TextBox Text4
- Height = 375
- Left = 5760
- TabIndex = 5
- Top = 2400
- Width = 2175
- End
- Begin TextBox Text3
- Height = 375
- Left = 5760
- TabIndex = 4
- Top = 1920
- Width = 2175
- End
- Begin TextBox Text10
- Height = 375
- Left = 3720
- TabIndex = 15
- Top = 1800
- Width = 1095
- End
- Begin TextBox Text2
- Height = 375
- Left = 6360
- TabIndex = 3
- Top = 1440
- Width = 1575
- End
- Begin TextBox Text1
- Height = 375
- Left = 6120
- TabIndex = 2
- Top = 960
- Width = 1815
- End
- Begin SSPanel SSPanel2
- AutoSize = 3 'AutoSize Child To Panel
- BevelWidth = 2
- BorderWidth = 2
- ForeColor = &H00000000&
- Height = 630
- Left = 5880
- TabIndex = 36
- Top = 240
- Width = 630
- Begin SSCommand SSCommand1
- AutoSize = 2 'Adjust Button Size To Picture
- Font3D = 3 'Inset w/light shading
- ForeColor = &H00000000&
- Height = 570
- Left = 30
- Picture = PLANET.FRX:1B12
- TabIndex = 37
- Top = 30
- Width = 570
- End
- End
- Begin SSPanel SSPanel3
- AutoSize = 3 'AutoSize Child To Panel
- BevelWidth = 2
- BorderWidth = 2
- ForeColor = &H00000000&
- Height = 630
- Left = 5040
- TabIndex = 38
- Top = 240
- Width = 630
- Begin SSCommand Stopg
- AutoSize = 2 'Adjust Button Size To Picture
- Font3D = 3 'Inset w/light shading
- ForeColor = &H00000000&
- Height = 570
- Left = 30
- Picture = PLANET.FRX:1E14
- TabIndex = 39
- Top = 30
- Width = 570
- End
- End
- Begin SSPanel SSPanel1
- AutoSize = 3 'AutoSize Child To Panel
- BevelInner = 1 'Inset
- BevelWidth = 2
- ForeColor = &H00000000&
- Height = 735
- Left = 6840
- TabIndex = 34
- Top = 120
- Width = 735
- Begin PictureBox Picture4
- Height = 525
- Left = 105
- Picture = PLANET.FRX:2116
- ScaleHeight = 495
- ScaleWidth = 495
- TabIndex = 35
- Top = 105
- Width = 525
- End
- End
- Begin SSCommand graphset
- Caption = "Graph Set"
- Font3D = 3 'Inset w/light shading
- ForeColor = &H00000000&
- Height = 930
- Left = 3720
- Picture = PLANET.FRX:2418
- TabIndex = 0
- Top = 120
- Width = 1050
- End
- Begin PictureBox graph
- AutoRedraw = -1 'True
- Height = 3135
- Left = 120
- ScaleHeight = 100
- ScaleMode = 0 'User
- ScaleWidth = 100
- TabIndex = 24
- Top = 120
- Width = 3495
- End
- Begin Label Label7
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Time Interval"
- Height = 195
- Left = 4920
- TabIndex = 23
- Top = 4800
- Width = 1125
- End
- Begin Label Label5
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Planet's Angle"
- Height = 195
- Left = 4920
- TabIndex = 21
- Top = 4320
- Width = 1230
- End
- Begin Label Label6
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Planet's Velocity"
- Height = 195
- Left = 4920
- TabIndex = 22
- Top = 3840
- Width = 1425
- End
- Begin Label Label9
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Sun's Y"
- Height = 195
- Left = 4920
- TabIndex = 26
- Top = 3360
- Width = 660
- End
- Begin Label Label8
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Sun's X"
- Height = 195
- Left = 4920
- TabIndex = 25
- Top = 2880
- Width = 660
- End
- Begin Label Label4
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Planet Y"
- Height = 195
- Left = 4920
- TabIndex = 20
- Top = 2400
- Width = 735
- End
- Begin Label Label13
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Graph Y"
- Height = 195
- Left = 3720
- TabIndex = 27
- Top = 2280
- Width = 705
- End
- Begin Label Label3
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Planet X"
- Height = 195
- Left = 4920
- TabIndex = 19
- Top = 1920
- Width = 735
- End
- Begin Label Label14
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Graph X"
- Height = 195
- Left = 3720
- TabIndex = 28
- Top = 1560
- Width = 705
- End
- Begin Label Label2
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Mass of Planet"
- Height = 195
- Left = 4920
- TabIndex = 18
- Top = 1440
- Width = 1275
- End
- Begin Label Label1
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "Mass of Sun"
- Height = 195
- Left = 4920
- TabIndex = 17
- Top = 960
- Width = 1065
- End
- Begin Menu file
- Caption = "&File"
- Begin Menu about
- Caption = "&About"
- End
- Begin Menu done
- Caption = "&Exit"
- End
- End
- Begin Menu dat1
- Caption = "&Data"
- Begin Menu rate
- Caption = "Sample &Rate"
- End
- Begin Menu dat
- Caption = "&Show"
- End
- End
- Const pi = 3.14159265359
- Const g = 6.67E-11!
- Dim init As Single
- Dim dragitem As String
- Dim tim As Single
- Dim n As Integer
- Dim msg As String
- Dim timepast As Single
- Dim xol As Double
- Dim yol As Double
- Dim com As Single
- Sub about_Click ()
- orbita.Show
- End Sub
- Sub dat_Click ()
- datas.Show
- End Sub
- Sub datarec_Click ()
- If datarec.value = 1 Then
- Load datas
- rate_click
- End If
- Beep
- End Sub
- Sub done_Click ()
- msg = "Thank You!"
- mark_c
- End
- End Sub
- Sub Form_Load ()
- msg = "Welcome to ORBIT!!"
- samplerate = 1
- End Sub
- Sub graph_DragDrop (Source As Control, X As Single, Y As Single)
- graph.PSet (X, Y)
- Select Case dragitem
- Case Is = "sun"
- text11.text = Format$(X)
- text12.text = Format$(Y)
- Case Is = "planet"
- text3.text = Format$(X)
- text4.text = Format$(Y)
- Case Is = "vortex"
- text11.text = Format$(X)
- text12.text = Format$(Y)
- text1.text = Str$(-1)
- Case Is = "sun2"
- sons.Show
- sons.sun2xs.text = Str$(X)
- sons.sun2ys.text = Str$(Y)
- End Select
-
- End Sub
- Sub graph_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
- text10.text = Format$(X)
- text16.text = Format$(Y)
- End Sub
- Sub graph_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
- text10.text = Str$(X)
- text16.text = Str$(Y)
- End Sub
- Sub graphset_Click ()
- initgraph.Show
- End Sub
- Function gravx (xol As Double) As Single
- gravx = (-1) * g * (xol - sun2x) * sun2 * com / ((sun2x - xol) ^ 2 + (sun2y - yol) ^ 2) ^ (3 / 2)
- End Function
- Function gravy (yol As Double) As Single
- gravy = (-1) * g * sun2 * com * (yol - sun2y) / ((sun2x - xol) ^ 2 + (sun2y - yol) ^ 2) ^ (3 / 2)
- End Function
- Sub mark_c ()
- marquee$ = msg
- thewidth = mark.TextWidth(marquee$)
- Do While mark.TextWidth(marquee$) < mark.scalewidth + thewidth
- marquee$ = marquee$ + " "
- For X& = 1 To Len(marquee$)
- a$ = Mid$(marquee$, 1, X&)
- mark.currentx = mark.scalewidth - mark.TextWidth(a$)
- mark.Print a$;
- q = DoEvents()
- mark.Cls
- End Sub
- Sub Picture1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- picture1.Drag 1
- dragitem = "sun"
- End Sub
- Sub Picture1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- picture1.Drag 2
- End Sub
- Sub Picture2_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- picture2.Drag 1
- dragitem = "planet"
- End Sub
- Sub Picture2_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- picture2.Drag 2
- End Sub
- Sub Picture3_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- picture3.Drag 1
- dragitem = "vortex"
- End Sub
- Sub Picture3_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- picture3.Drag 3
- End Sub
- Sub rate_click ()
- datarate.Show 1
- End Sub
- Sub SSCommand1_Click ()
- On Error GoTo a:
- sun = Val(text1.text)
- com = Val(text2.text)
- xol = Val(text3.text)
- yol = Val(text4.text)
- coma = Val(text5.text)
- comv = Val(text6.text)
- timi = Val(text7.text)
- suny = Val(text12.text)
- sunx = Val(text11.text)
- xvo = -comv * (Cos((coma * pi) / 180))
- yvo = comv * (Sin((coma * pi) / 180))
- msg = "Nice Orbit!"
- graph.PSet (sunx, suny)
- If seconds.value = 1 Then
- graph.PSet (sun2x, sun2y)
- End If
- If datarec.value = 1 Then datas.points.row = 0
- n = 0
- timepast = 0
- ptg = ((1 / timi) / samplerate)
- p = 0
- Do
- timepast = timepast + timi
- graph.PSet (xol, yol)
- gxo = (-1) * g * (xol - sunx) * sun * com / ((sunx - xol) ^ 2 + (suny - yol) ^ 2) ^ (3 / 2)
- gyo = (-1) * g * sun * com * (yol - suny) / ((sunx - xol) ^ 2 + (suny - yol) ^ 2) ^ (3 / 2)
- If seconds.value = 1 Then
- gxo = gxo + gravx(xol)
- gyo = gyo + gravy(yol)
- End If
- xvn = xvo + gxo * timi
- yvn = yvo + gyo * timi
- xnl = xol + timi * (xvo + xvn) / 2
- ynl = yol + timi * (yvo + yvn) / 2
- If (datarec.value = 1) And p = ptg Then
- datas.points.col = 0
- datas.points.text = Format$(timepast, "0.00#")
- datas.points.col = 1
- datas.points.text = Format$(xol, "0.00#")
- datas.points.col = 2
- datas.points.text = Format$(yol, "0.00#")
- datas.points.col = 3
- datas.points.text = Format$(xvo, "0.00#")
- datas.points.col = 4
- datas.points.text = Format$(yvo, "0.00#")
- datas.points.col = 5
- datas.points.text = Format$(gxo, "0.00#")
- datas.points.col = 6
- datas.points.text = Format$(gyo, "0.00#")
- datas.points.row = datas.points.row + 1
- p = 0
- End If
- xol = xnl
- yol = ynl
- xvo = xvn
- yvo = yvn
- other% = DoEvents()
- p = p + 1
- Loop Until n = 1
- mark_c
- Exit Sub
- saveErr% = Err
- generalerrors
- Exit Sub
- End Sub
- Sub SSCommand2_Click ()
- graph.Cls
- If gridison Then
- griddraw "x", gridx, 1
- griddraw "y", gridy, 1
- End If
- End Sub
- Sub Stopg_Click ()
- n = 1
- msg = "Graph Stopped"
- End Sub
- Sub suns_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- If seconds.value = 1 Then
- picture1.Drag 1
- dragitem = "sun2"
- End If
- End Sub
- Sub suns_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- If seconds.value = 1 Then
- picture1.Drag 2
- End If
- End Sub
- Sub Text1_Change ()
- sun = Val(text1.text)
- End Sub
- Sub Text2_Change ()
- com = Val(text2.text)
- End Sub
- Sub Text7_Change ()
- If text7.text = "" Then datarec.enabled = 0 Else datarec.enabled = -1
- End Sub
-